home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Demos
/
A.D. Software
/
OOFILE
/
OOFILE AppMaker
/
FileAndFind
/
Pre-built version, as generated
/
CFileAndFindApp.cp
< prev
next >
Wrap
Text File
|
1995-09-30
|
4KB
|
190 lines
// CFileAndFindApp.cp -- application methods
// Created 01/01/95 12:01 PM by AppMaker
#include "CFileAndFindApp.h"
#include "CFileAndFindDoc.h"
#include "CListArticles.h"
#include "CAboutDialog.h"
#include "CEditArticle.h"
#include <UDesktop.h>
#include <URegistrar.h>
#include <UScreenPort.h>
#include <PPobClasses.h>
#include <PP_Messages.h>
// ---------------------------------------------------------------------------
// • CFileAndFindApp
// ---------------------------------------------------------------------------
// Default constructor
CFileAndFindApp::CFileAndFindApp()
:LDocApplication()
{
UScreenPort::Initialize();
RegisterClasses();
SetUpMenus();
// initialize app's data:
}
// ---------------------------------------------------------------------------
// • ~CFileAndFindApp
// ---------------------------------------------------------------------------
// Destructor
//
CFileAndFindApp::~CFileAndFindApp()
{
}
// ---------------------------------------------------------------------------
// • RegisterClasses
// ---------------------------------------------------------------------------
//
void
CFileAndFindApp::RegisterClasses()
{
RegisterAllPPClasses();
// replace to register only classes that we use.
// windows know what classes they use
// so call static functions in each window/dialog,
// or generate a single function as union of all w/d's.
// register custom pane classes
URegistrar::RegisterClass('Liss', (ClassCreatorFunc)CListArticles::CreateListArticlesStream);
URegistrar::RegisterClass('Abog', (ClassCreatorFunc)CAboutDialog::CreateAboutDialogStream);
URegistrar::RegisterClass('Edie', (ClassCreatorFunc)CEditArticle::CreateEditArticleStream);
}
// ---------------------------------------------------------------------------
// • SetUpMenus
// ---------------------------------------------------------------------------
//
void
CFileAndFindApp::SetUpMenus()
{
}
// ---------------------------------------------------------------------------
// • StartUp
// ---------------------------------------------------------------------------
// The application calls this member function automatically when the application
// is opened
void
CFileAndFindApp::StartUp()
{
ObeyCommand(cmd_Open, nil);
}
//----------
LModelObject*
CFileAndFindApp::MakeNewDocument()
{
CFileAndFindDoc *theDoc = new CFileAndFindDoc(this);
theDoc->newFile();
return theDoc;
}
//----------
// called from SendAEOpenDoc in response to Open command
void
CFileAndFindApp::OpenDocument(
FSSpec *inMacFSSpec)
{
CFileAndFindDoc *theDoc = new CFileAndFindDoc(this);
theDoc->openFile (inMacFSSpec);
}
//----------
// called from LDocApplication in response to Open command
void
CFileAndFindApp::ChooseDocument()
{
SFTypeList typeList;
short numTypes;
StandardFileReply macFileReply;
typeList[0] = kFileType;
numTypes = 1;
UDesktop::Deactivate();
::StandardGetFile(nil, numTypes, typeList, &macFileReply);
UDesktop::Activate();
if (macFileReply.sfGood) {
SendAEOpenDoc(macFileReply.sfFile);
}
}
// ---------------------------------------------------------------------------
// • ObeyCommand
// ---------------------------------------------------------------------------
// Respond to commands
Boolean
CFileAndFindApp::ObeyCommand(
CommandT inCommand,
void *ioParam)
{
Boolean cmdHandled = true;
switch (inCommand) {
case cmd_About:
CAboutDialog::CreateAboutDialog(this);
break;
// +++ Add cases here for the commands you handle
// Remember to add same cases to FindCommandStatus below
// to enable/disable the menu items for the commands
default:
cmdHandled = LDocApplication::ObeyCommand(inCommand, ioParam);
break;
}
return cmdHandled;
}
// ---------------------------------------------------------------------------
// • FindCommandStatus
// ---------------------------------------------------------------------------
// Pass back status of a (menu) command
void
CFileAndFindApp::FindCommandStatus(
CommandT inCommand,
Boolean &outEnabled,
Boolean &outUsesMark,
Char16 &outMark,
Str255 outName)
{
outUsesMark = false;
switch (inCommand) {
// +++ Add cases here for the commands you handle
default:
LDocApplication::FindCommandStatus(inCommand, outEnabled, outUsesMark,
outMark, outName);
break;
}
}